<%--
 - Copyright (c) 2009-2011 ETCORE Labs. All rights reserved. 
 - 
 - This software is the confidential and proprietary information of ETCORE Labs. 
 - You shall not disclose such confidential information and shall use it only
 - in accordance with the terms of the license agreement you entered into
 - with ETCORE Labs.
 -
 - Support can be obtained from support forums at:
 - http://www.etcore.com/
 -
 - @author: ETCORE GroupTalk developers
 -
 --%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/taglibs/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><c:out value='${context.login }' />-<c:out
	value='${context.title }' /></title>
<link rel="stylesheet" href="/group/css/styles.css" type="text/css">
<script language="javascript">
function  showLoginWin()  {
	showDivControl('loginWin',320,280);
}

function  showRegisterWin()  {
   showDivControl('registerWin',410,345);
	
}

 
function checkLoginForm()
{
if(LoginForm.userName.value==""||LoginForm.userName.value.replace(/(^\s*)|(\s*$)/g, "")=="")
{
LoginForm.userName.value="";
alert("<c:out value='${context.msg_user_null}' />");
LoginForm.userName.focus();
return false;
}
if(LoginForm.userPwd.value=="")
{
alert("<c:out value='${context.msg_pwd_null}' />");
LoginForm.userPwd.focus();
return false;
}

return true;
}


function checkRegisterForm()
{
if(RegisterForm.userName.value==""||RegisterForm.userName.value.replace(/(^\s*)|(\s*$)/g, "")=="")
{
alert("<c:out value='${context.msg_user_null}' />");
RegisterForm.userName.focus();
return false;
}
if(RegisterForm.userPwd.value=="")
{
alert("<c:out value='${context.msg_pwd_null}' />");
RegisterForm.userPwd.focus();
return false;
}
var pwd=RegisterForm.userPwd.value;
if(pwd.length<6)
{
alert("<c:out value='${context.msg_pwd_length_note}' />");
return false;
}

if(RegisterForm.userPwd.value!=RegisterForm.userPwd1.value)
{
alert("<c:out value='${context.msg_new_pwd_same}' />");
RegisterForm.userPwd.focus();
return false;
}
if(RegisterForm.userEmail.value==""||RegisterForm.userEmail.value.replace(/(^\s*)|(\s*$)/g, "")=="")
{
alert("<c:out value='${context.msg_mail_null}' />");
RegisterForm.userEmail.focus();
return false;
}


var emailStr=RegisterForm.userEmail.value;
var emailPat=/^(.+)@(.+)$/;
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
 alert("<c:out value='${context.msg_mail_format}' />")
 return false;
}
var loadingGif=document.getElementById("loadingGif");
loadingGif.style.display='';
 
return true;
}

</script>
</head>
<body  >
<c:if test="${empty init }" ><c:set var="init" value="${param.init }" /></c:if>
<c:if test="${empty session_user }">


<div style="position:absolute; top:0; z-index:10"><a onclick="showLoginWin()" href="#"><c:out value='${context.login}' /></a> & <a onclick="showRegisterWin()" href="#"><c:out
	value="${context.register}" /></a></div>


 
<!-- login form -->
<div id=loginWin
	style="display: none; valign: center; position: absolute; top: 20%; left: 30%; width: 320px; height: 165px; padding: 0px; border: 1px solid orange; background-color: white; z-index: 1002; overflow: hidden;">
<table cellSpacing=0 cellPadding=0 width=100%>
	<tr bgcolor="orange">
		<td  width=100% style="  height:20px "> 
	 
		<img src="/group/images/winlogo.gif"   border=0/>&nbsp;<b><c:out value='${context.msg_login_note}' /></b>
		 
			 
		 </td>
		<td width=25 align=right>
		 <img src="/group/images/close.gif"
			onClick="hideDivControl('loginWin')"  style="cursor:pointer;" border=0 /> 
		</td>
	</tr>


	<tr>
		<td style="height: 10px;"></td>
	</tr>


	<tr>
		<td height=100% colspan=2 align=center width=100%>
		<form action="/group/login<c:out value='${context.postfix }' />"
			name="LoginForm" method="post"><input type="hidden" name="cmd"
			value="userLogin">
		<table align=center cellSpacing=0 cellPadding=0 width=100%>

			<tr>
				<td align="right" width=90 style="height: 40px;"><c:out
					value='${context.text_user_name}' /> &nbsp;</td>
				<td><input type="text" style="width:155px"  name="userName" size="20" maxlength="55"  onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\_\@\.]/g,'')"
					></td>
			</tr>
			<tr>
				<td align="right"   width=90 style="height: 40px;"  ><c:out
					value='${context.text_pwd}' /> &nbsp;</td>
				<td><input style="width:155px" type="password" name="userPwd" size="20"
					maxlength="55"></td>
			</tr>
			<tr>
				<td style="height: 40px;" colspan="2" align="center">
				<input type=button onclick="showRegisterWin()" style="cursor:pointer;"
					value="&nbsp;<c:out value='${context.register}' />&nbsp;">&nbsp;<input style="cursor:pointer;"
					type="submit" onclick="return checkLoginForm();"
					value="&nbsp;<c:out value='${context.login}' />&nbsp;">
					
				</td>
			</tr>

		</table>
		</form>
		</td>
	</tr>
</table>


</div>

<!-- register form -->
<div id=registerWin
	style="display: none; valign: center; position: absolute; top: 20%; left: 30%; width: 410px; height: 345px; padding: 0px; border: 1px solid orange; background-color: white; z-index: 1002; overflow: hidden;">
<form name="RegisterForm" onSubmit="return checkRegisterForm();"
	method=post
	action="/group/userRegister<c:out value='${context.postfix }' />">
<input type=hidden name="cmd" value="userRegister">
<table width=100% cellspacing=0 cellpadding=0>
	<tr bgcolor="orange">
		<td width=100%><img src="/group/images/winlogo.gif"/>&nbsp;<b><c:out
			value='${context.register}' /></b></td>
		<td width=25 align=right>
		<div style=""><img src="/group/images/close.gif"  style="cursor:pointer;"
			onClick="hideDivControl('registerWin')" border=0 /></div>
		</td>
	</tr>

<tr><td colspan=2 align=center width=100%>

<table  width=100%>

	<TR>
		 
		<TD colspan=2 align=center><c:out
			value='${context.msg_must_content }' /></TD>
	</TR>
	<c:if test="${not empty msg }">
	<tr><td colspan=2 align=center>
	<font color=red><b><c:out value='${msg}' /></b></font></td></tr></c:if>
	<TR>
		<TD style="height: 40px;" align=right><c:out
			value='${context.text_user_name }' />&nbsp;&nbsp;&nbsp;</TD>
		<TD>		
		<c:if test="${not empty param.userName}">
		<input type=text style="width:160px" <c:out value="value=${ param.userName}" />  name="userName"
			maxlength="45" size="55"   onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9_\@\.]/g,'')"
			 >
	   </c:if>	   
	   	<c:if test="${ empty param.userName}">
		<input type=text style="width:160px"   name="userName"
			maxlength="45" size="55"  >
	   </c:if>
		</TD>
	</TR>
	<TR>
		<TD style="height: 40px;" align=right><c:out
			value='${context.text_pwd }' />&nbsp;&nbsp;&nbsp;</TD>
		<TD><input type=password name="userPwd" maxlength="55" style="width:160px"  size="20">
		<SPAN class=text_orange><c:out
			value='${context.msg_pwd_length_note }' /></SPAN></TD>
	</TR>
	<TR>
		<TD style="height: 40px;" align=right><c:out
			value='${context.text_pwd2 }' />&nbsp;&nbsp;&nbsp;</TD>
		<TD><input type=password name="userPwd1" style="width:160px" maxlength="55" size="20">
		<SPAN class=text_orange> </SPAN></TD>
	</TR>
	<TR>
		<TD style="height: 40px;" align=right>Email&nbsp;&nbsp;&nbsp;</TD>
		<TD>
		<c:if test="${not empty param.userEmail}">
		<input type="text" name="userEmail" style="width:160px" maxlength="55" size="20" <c:out value="value=${ param.userEmail}" /> >
		 </c:if>
		<c:if test="${ empty param.userEmail}">
		<input type="text" name="userEmail" style="width:160px" maxlength="55" size="20" >
		 </c:if>
		<SPAN class=text_orange> </SPAN></TD>
	</TR>
	<TR>
		<TD style="height: 30px;" align=right><c:out
			value='${context.text_code }' />&nbsp;&nbsp;&nbsp;</TD>
		<TD><input type="text" name="rand" maxlength="40" size="10">

		</TD>
	</TR>
	<TR>
		<TD style="height: 30px;" >&nbsp;&nbsp;</TD>
		<TD><img src="/group/img.jsp"  >&nbsp;&nbsp;<br/></TD>
	</TR>
	<TR>
		<TD style="height: 20px; " colspan=2 align=center valign=top>
		<div id="loadingGif" style="width:100;position:absolute;z-index:1010;display:none;align:center;"><img src="/group/images/loading.gif"  border=0/>&nbsp;running... </div></TD>
	</TR>
	<TR align=center>
		<TD colSpan=2 style="height: 20px;" >
		<input type=submit style="cursor:pointer;" value="<c:out value='${context.register }' />"
			name="submit">	 
		</TD>
	</TR>
</TABLE>
</td></tr></table>
</form>
</div>




 

 

<script>
<c:if test="${init=='login'}">showLoginWin(); </c:if>
<c:if test="${init=='register'}">showRegisterWin(); </c:if>
</script>


</c:if>

</BODY>
</HTML>
